﻿#include "dialogsetting.h"
#include "ui_dialogsetting.h"

DialogSetting::DialogSetting(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogSetting)
{
    ui->setupUi(this);
    int workSteps=config.getConfig(QString("workSteps"));
    ui->spinBoxWork->setValue(workSteps);
    int breakSteps=config.getConfig(QString("breakSteps"));
    ui->spinBoxBreak->setValue(breakSteps);
    int postoffMax=config.getConfig(QString("postoffMax"));
    ui->spinBoxPostoff->setValue(postoffMax);
}

DialogSetting::~DialogSetting()
{
    delete ui;
}

void DialogSetting::on_pushButton_clicked()
{
    int workSteps=ui->spinBoxWork->value();
    int breakSteps=ui->spinBoxBreak->value();
    int postoffMax=ui->spinBoxPostoff->value();

    config.setConfig(QString("workSteps"), workSteps);
    config.setConfig(QString("breakSteps"), breakSteps);
    config.setConfig(QString("postoffMax"), postoffMax);
    emit sendUpdateConfig();
    this->accept();
}

